<HTML>
<HEAD>

<TITLE>Samples</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
<link href="RaknetManual.css" rel="stylesheet" type="text/css">
<meta name="title" content="RakNet - Advanced multiplayer game networking API">
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#003399" vlink="#003399" alink="#003399" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"">
<img src="RakNetLogo.jpg" alt="Oculus VR, Inc."><BR><BR>

<table width="100%" border="0"><tr><td bgcolor="#6699CC">
<img src="spacer.gif" width="8" height="1">Samples</td></tr></table>
<TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" WIDTH="100%"><TR><TD>
  <p>Overview of the samples and test code.
    <BR>
    <BR>
    
      All the following samples are located under <I>Samples\Code Samples</I><BR>
  <BR>
  <B>
    AutopatcherClient<br>
    AutopatcherServer</B><BR>
  <I>Intermediate</I><BR>
      The autopatcher samples demonstrates the user of the autopatcher system.  To run it, start one instance one of the AutoPatcherClient sample, and one of the AutoPatcherServer. The server uses the provided PostgreRepository class to store the application files in a a PostgreSQL database.<br>
      The client sample (AutopatcherClient) doesn't know anything about the mechanism used by the server to store the applications. It justs asks for patchs for applications. <br>
  <br>
  <strong>BitPacketTest</strong><br>
  <em>Beginner</em><br>
      This sample tests the packet splitting capabilities of RakNet.
      All it does is send a large block of data to the feedback loop.<br>
  <BR>
  <B>BitStream</B><BR>
  <I>Beginner</I><BR>
      The bitstream sample doesn't have much functionality but is instead intended to provide a clear sample of how to write and read bitstreams.  It is all contained in one program and uses RPC to transmit the data.  It writes a string and some numbers and shows how to read branching data.<BR>
  <BR>
  <B>Chat Example Client<br>
    Chat Example Server</B><BR>
  <I>Beginner</I><BR>
      A simple chat server and a simple chat client.  Unlike a real game, it encodes strings directly into the data stream and reads them out directly.  Normally you would use a packet ID.  It use static data to transmit the name and message of the day.  To test, run an instance of the server and two or more instances of the client.<BR>
  <BR>
  <B>Client File Verification</B><BR>
  <I>Intermediate</I><BR>
      This sample will read all the files in the Debug directory, generate a 20 byte SHA-1 code for them, and send that over the network.  If the code generated by the client and server match then the files are good.  This shows a simple way to test the integrity of files on the client - although you will have to take other steps to prevent them from being modified in memory or changed after this test.<br>
  <br>
  <strong>CommandConsoleClient<br>
    CommandConsoleServer<br>
  </strong><em>Intermediate<br>
  </em>CommandConsoleClient demonstrates connecting to the command console, using the RakNet transport protocol. It's the equivalent of a secure telnet client.<br>
  CommandConsoleServer demonstrates the command console server, which can be which can be a standalone application or part of your game server.  It allows you to easily parse text strings sent from a client using either secure RakNet or Telnet.
  <BR>
        <BR>
        <B>Compression</B><BR>
        <I>Intermediate</I><BR>
    This sample shows how to use the global compression scheme in RakNet.  You have to start two or more instances of the program, passing nothing when queried for the frequency tables.  Then chat for a while to 'train' the data.  After quitting you will be prompted to save the frequency tables.  The server should then send its frequency table to the clients, and one of the clients send its frequency table to the server.  For better accuracy you can sum up the frequencies from all the clients and send that.  Then start the program over again and enter the files you just generated when prompted.  If everything works, you can chat again.  When you quit you will be given statistics on how much bandwidth you saved by sending compressed data.<br>
    <br>
    <strong>ConnectionGraph</strong><br>
    <em>Beginner</em><br>
    This sample demonstrates the connection graph plugin, which is used to maintain a list of all connections on the network.<br>
    <br>
    <strong>DirectoryDeltaTransferTest</strong><br>
    <em>Intermediate</em><br>
    This sample demonstrates the plugin to incrementally transfer compressed deltas of directories.  In essence, it's a simple autopatcher.<br>
    Unlike the full autopatcher, it has no dependencies.  It is suitable for patching from non-dedicated servers at runtime.
    <br>
    <BR>
        <B>Dropped Connection Test</B><BR>
        <I>Intermediate</I><BR>
    This test randomly starts and stops connections for n clients, where n can be changed from a define at the top of the file.  Since all clients are in the same exe on the same computer the n threads created may slow things down.<BR>
        <BR>
        <B>Encryption</B><BR>
        <I>Intermediate</I><BR>
    This is a tutorial on how to load, save, and use RSA keys with <A HREF="secureconnections.html">secure connections</A>.  The process is difficult to explain in a manual but easy to follow in code.  Helpful to have some familiarity with RSA encryption.<BR>
        <BR>
        <B>Flow Control Test</B><BR>
        <I>Beginner</I><BR>
    RakNet automatically handles flow control, which is evident from this test.  This test only really has meaning when run over the internet, where there is limited bandwidth.  You can also try using RakPeer::ApplyNetworkSimulator to make things look more real.<BR>
        <BR>
        <B>FullyConnectedMesh<br>
        </B><em>Beginner<br>
        </em>This project tests and demonstrates the fully connected mesh plugin. No data is actually sent so it's mostly a sample of how to use a plugin.<br>
        <em><br>
        </em><B>LANServerDiscovery</B><BR>
        <I>Beginner</I><BR>
        Sends an offline ping to everyone at IP "255.255.255.255".  All active servers on a LAN should respond with a pong.<br>
        <br>
        <BR>
        <B>LoopbackPerformanceTest</B><BR>
        <I>Intermediate</I><BR>
    The loopback performance test is good for discovering implementation flaws and measuring implementation efficiency.  It is fairly complex with a large number of parameters but has defaults for everything - just hit enter.  You will need to start 3 instances of the program and enter 1, then 2, then 3 when prompted.  You can hit enter for all other parameters if you wish.  Detailed statistics are shown during runtime and at the end of the test.<br>
    <br>
    <strong>MessageFilter</strong><br>
    <em>Beginner</em><br>
    Demostrates the use of the MessageFilter plugin to filter all incoming messages<font color="#666666" size="2" face="Geneva, Verdana, Arial, Helvetica, sans-serif">, and only allow messages of a certain type.<BR>
    <br>
    <strong>NATPunchTrough</strong><br>
    <em>Intermediate</em><br>
    Shows how to use the NatPunchthrough plugin to connect two system that are both behind NATs. <br>
    <br>
    <strong>ObjectMemberRPC</strong><br>
    <em>Advanced</em><br>
    Shows how to make RPC on object methods. You need to runs two instances, one as a server, and one as a client.<br>
    Also, you should understand the basics about <a href="networkidobject.html">NetworkIDObject</a> .<br>
    <br>
    <strong>OfflineMessagesTest</strong><br>
    <em>Beginner</em><br>
    This project tests the advertise system and offline ping messages.<br>
    <br>
    <strong>PacketLoggerTest</strong><br>
    <em>Intermediate</em><br>
    Show how to use the PacketLogger class, to display all packets being sent or received.<br>
You can derive PacketLogger, and overwrite PacketLogger::WriteLog to render output into your own program.<br>
<BR>
      <B>Ping</B><BR>
      <I>Beginner</I><BR>
    Starts a server, then a client, then does an unconnected ping between the two.<BR>
      <BR>
      <B>RakVoice</B><br>
      <strong>RakVoiceFMOD</strong><BR>
      <I>Intermediate</I><BR>
    These two projects show how to integreate RakVoice with a sound engine. RakVoice sample show how to integrate with portaudio, and RakVoiceFMOD shows how to integrate wit FMOD sound engine.<br>
    This uses peer to peer connections between all chatting systems.<BR>
    See <A HREF="rakvoice.html">rakvoice.html</A> for more details.<BR>
      <BR>
      <B>Reliable ordered test</B><BR>
      <I>Beginner</I><BR>
    Continually sends packets using reliable ordered from a sender to a receiver.  The receiver checks the packet data to make sure the packets arrived in order.<BR>
      <BR>
      <B>Remote Procedure Calls</B><BR>
      <I>Intermediate</I><BR>
    Shows how to send a message to the server using RPC, and then using RPC to send that message back to the client.  Very simple - just look at the code.<BR>
      <br>
      <strong>ReplicaManagerCS</strong><br>
      <strong>ReplicaManagerP2P</strong><br>
      <em>Advanced</em><br>
      Shows how to use the ReplicaManager class in a Client/Server environment or P2P. ReplicaManager  is a very lightweight and efficient system that provides object creation, destruction, and serialization updates such that you have all copies of all desired objects on all desired systems semi-automatically.<br>
      See <a href="replicamanager.html">ReplicaManager</a> for more details.<br>
      <br>
      <strong>Router</strong><br>
      <em>Advanced</em><br>
      Demonstration of the Router plugin. The Router plugin exposes a Send function allowing you to send to systems you are not directly connected to. <br>
      <BR>
      <B>ServerEnumeration and StaticClient Data</B><BR>
      <I>Intermediate</I><BR>
    A client connects to a server and static data is shared between them.  This sample covers all functionality associated with this and shows the more complex cases where you want to update data on the other system or only change data locally.<BR>
      <BR>
      <B>Timestamping</B><BR>
      <I>Beginner</I><BR>
    In this sample, a sender writes the timestamp identifier and a timestamp into a byte stream and sends it to a recipient.  It demonstrates how RakNet will automatically modify the timestamp so that it is system relative. <BR>
       </p>
  </TD>
</TR></TABLE>
<table width="100%" border="0"><tr><td bgcolor="#6699CC">
<img src="spacer.gif" width="8" height="1">See Also</td></tr></table>
<TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" WIDTH="100%"><TR><TD>

<A HREF="index.html">Index</A><BR>

</TD></TR></TABLE>
</BODY>
</HTML>
